const global = require('global');
cc.Class({
    extends: cc.Component,

    properties: {
		btnnode:cc.Node,
		gamescene:cc.Prefab,		
		qkcell:cc.Prefab,
    },

    onLoad () {
		//生成关卡选择按钮
		this.creategk();
		cc.director.on('qkclick',(e)=>{//e.detail : this._gkid
			cc.director.emit('qkselect',e.detail);
			this.returnbtn();
		},this);
		cc.log('selectpanel:global.gkjindu='+global.gkjindu);
    },

    returnbtn() {
		this.node.opacity = 0;
		cc.director.getScheduler().schedule(() => {
			this.node.x += 20;
		}, this, 1/64, 63);
	},
	creategk(){
		for(let i = 14;i>=1;i--){
			let qkcell = cc.instantiate(this.qkcell);
			qkcell.parent = this.btnnode;
			cc.director.emit('qkcell',15-i);
		}
	}
    // update (dt) {},
});
